d3c2a15328a930ab2acda69deaa4c4ea45189d18,src/test/java/com/thoughtworks/gauge/test/implementation/DataStore.java,DataStore,addToDataStore,#String#String#Table#,15
Before Change
public class DataStore {
@Step("Create a scenario <newScenario> in specification <newSpec> with steps to read and write to datastore <table>")
public void addToDataStore(String scenario, String spec, Table datastoreValues) throws Exception {
List<String> columnNames = datastoreValues.getColumnNames();
Table table = new Table(Arrays.asList(columnNames.get(0), "implementation"));
List<TableRow> rows = datastoreValues.getTableRows();
TableRow row = rows.get(0);
table.addRow(Arrays.asList(row.getCell(columnNames.get(0)), currentProject.getDataStoreWriteStatement(row, columnNames)));
row = rows.get(1);
table.addRow(Arrays.asList(row.getCell(columnNames.get(0)), currentProject.getDataStorePrintValueStatement(row, columnNames)));
After Change
public void addToDataStore(String scenario, String spec, Table datastoreValues) throws Exception {
new SpecificationBuilder().withScenarioName(scenario)
.withSpecName(spec)
.withDataStoreWriteStatement(datastoreValues.getColumnNames(), datastoreValues.getTableRows().get(0))
.withDataStorePrintValues(datastoreValues.getColumnNames(), datastoreValues.getTableRows().get(1))
.withAppendCode(true)
.buildAndAddToProject();